package cn.tk.model.entity.mr;

import cn.tk.model.entity.AbstractEntity;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Objects;

/**
 * Created by denglw on 2021/8/3.<br/>
 * Desc: 变量
 */
@Data @NoArgsConstructor
@Entity(name = "mrVariable")
@Table(name = "mr_variable")
public class Variable extends AbstractEntity {

    /**
     * bot id
     */
    private Long botId;

    /**
     * 中文名
     */
    private String name;

    /**
     * 英文名
     */
    private String enName;

    /**
     * 变量类型：1枚举 2个性
     */
    private Integer type;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Variable)) {
            return false;
        }
        Variable variable = (Variable) o;
        return Objects.equals(variable.getId(), getId())
                && Objects.equals(botId, variable.botId)
                && Objects.equals(name, variable.name)
                && Objects.equals(enName, variable.enName)
                && Objects.equals(type, variable.type);
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId(), botId, name, enName, type);
    }
}
